package com.mmren.edu.dtx.controller;

import com.mmren.edu.common.result.CommonResult;
import com.mmren.edu.dtx.service.OrderService;
import com.mmren.edu.dtx.vo.OrderVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 欢迎来到牧码人教育，做Java我们是专业的
 *
 * @创建人： 牧码人教育-Gerry
 * @创建时间： 2020-4-20
 * @功能描述：
 */
@RestController
@RequestMapping("v1/api/order")
@Slf4j
public class OrderController {
    @Autowired
    private DiscoveryClient discoveryClient;

    @Autowired
    private OrderService orderService;

    @PostMapping
    public CommonResult saveOrder(@RequestBody OrderVO vo) {
        boolean flag = orderService.saveOrder(vo);
        log.info("================================>server port is ");
        if(flag) {
            return CommonResult.OK();
        } else {
            return CommonResult.NO();
        }
    }
}
